package com.ridbor001.demo.bean;

import java.io.Serializable;
import java.util.UUID;

public class RDBGrade implements Serializable {
    private String gradeId;      // 成绩ID（如G001）
    private String studentId;    // 关联的学生ID
    private String courseId;   // 课程名称
    private String term;         // 学期（如2023-2024秋季）
    private double dailyScore;   // 平时成绩
    private double stageScore;   // 阶段成绩
    private double finalScore;   // 期末成绩

    // 无参构造
    public RDBGrade() {}

    // 全参构造（可选）
    public RDBGrade(String studentId, String courseId,
                    String term, double dailyScore, double stageScore, double finalScore) {
        this.gradeId = UUID.randomUUID().toString();
        this.studentId = studentId;
        this.courseId = courseId;
        this.term = term;
        this.dailyScore = dailyScore;
        this.stageScore = stageScore;
        this.finalScore = finalScore;
    }

    public RDBGrade(String gradeId, String studentId, String courseId, String term, double dailyScore, double stageScore, double finalScore) {
        this.gradeId = gradeId;
        this.studentId = studentId;
        this.courseId = courseId;
        this.term = term;
        this.dailyScore = dailyScore;
        this.stageScore = stageScore;
        this.finalScore = finalScore;
    }

    // Getter和Setter方法
    public String getGradeId() { return gradeId; }
    public void setGradeId(String gradeId) { this.gradeId = gradeId; }

    public String getStudentId() {
        return studentId;
    }

    public void setStudentId(String studentId) {
        this.studentId = studentId;
    }

    public String getCourseId() {
        return courseId;
    }

    public void setCourseId(String courseId) {
        this.courseId = courseId;
    }

    public String getTerm() {
        return term;
    }

    public void setTerm(String term) {
        this.term = term;
    }

    public double getDailyScore() {
        return dailyScore;
    }

    public void setDailyScore(double dailyScore) {
        this.dailyScore = dailyScore;
    }

    public double getStageScore() {
        return stageScore;
    }

    public void setStageScore(double stageScore) {
        this.stageScore = stageScore;
    }

    public double getFinalScore() {
        return finalScore;
    }

    public void setFinalScore(double finalScore) {
        this.finalScore = finalScore;
    }

    // 添加总评成绩计算方法
    public double calculateTotalScore() {
        return dailyScore * 0.3 + stageScore * 0.3 + finalScore * 0.4;
    }

    // 添加获取总评成绩的方法
    public double getTotalScore() {
        return calculateTotalScore();
    }
}